/**
 * Created by oiuyt on 2018/7/18.
 */
import React, { Component } from 'react';
import { Layout, Menu, Icon } from 'antd';
//import {Link} from 'react-router-dom';

const { Sider } = Layout;
const SubMenu = Menu.SubMenu;
class SiderMenu extends Component {
        constructor(props) {
                super(props);
                this.state = {defaultSelected: '/home/authorList'};
                //console.log("11")
                //console.log(props)
                console.log(window.aa)
        }
        handleClick = (e) => {
                //console.log('click ', e);
                //this.props.history.push({pathname:"/login",query :{id:100,name:"dd"}})
                this.props.history.push({pathname:e.key})
        }
        render() {
                return (
                            <Sider
                                trigger={null}
                                collapsible
                                collapsed={this.props.collapsed}
                            >
                                    <div className="logo">
                                            {!this.props.collapsed&&<span>CMS管理系统</span>}
                                            {this.props.collapsed&& <Icon type="home" />}
                                    </div>
                                    <Menu theme="dark" mode="inline" defaultSelectedKeys={[this.props.history.location.pathname]}  onClick={this.handleClick}>
                                            <Menu.Item key="/home/authorList">
                                                    <Icon type="user" />
                                                    <span>用户管理</span>
                                            </Menu.Item>
                                            <Menu.Item key="/home/news">
                                                    <Icon type="video-camera" />
                                                    <span>新闻中心</span>
                                            </Menu.Item>
                                            <Menu.Item key="/home/newsClassList">
                                                    <Icon type="upload" />
                                                    <span>新闻分类</span>
                                            </Menu.Item>
                                            <SubMenu key="sub1" title={<span><Icon type="mail" /><span>其他</span></span>}>
                                                    <Menu.Item key="/home/test8">test8</Menu.Item>
                                                    <Menu.Item key="6">广告管理</Menu.Item>
                                                    <Menu.Item key="7">数据备份</Menu.Item>
                                                    <Menu.Item key="/home/news/test9">在线编辑器</Menu.Item>
                                                    <Menu.Item key="/home/test10">formDemo</Menu.Item>
                                                    <Menu.Item key="/home/test13">hooksRedux</Menu.Item>
                                                    <Menu.Item key="/home/test14">hooksRedux2</Menu.Item>
                                            </SubMenu>
                                    </Menu>
                            </Sider>
                );
        }
}
export default SiderMenu